import CryptoJS from 'crypto-js';
let key = CryptoJS.enc.Utf8.parse('123456789ABCDEFG');
let iv = CryptoJS.enc.Utf8.parse('123456789ABCDEFG');
const cryptoEncrypt = (word) => {
  var encrypted = '';
  var srcs = '';
  if (typeof word == 'string') {
    srcs = word;
  } else if (typeof word == 'object') {
    //对象格式的转成json字符串
    srcs = JSON.stringify(word);
  }
  encrypted = CryptoJS.AES.encrypt(srcs, key, {
    iv: iv,
    mode: CryptoJS.mode.CBC,
    padding: CryptoJS.pad.ZeroPadding
  });
  return encrypted.ciphertext.toString();
};
export default {
  cryptoEncrypt
}

// 正则

export const phoneReg = /^1(3|4|5|7|8|9)\d{9}$/

export const passReg = /^[a-zA-Z0-9]{6,12}$/
